<template>
    <div id="member">
        <el-col :span="24" class="action-bar">
            <el-input v-model="searchText" placeholder="请输入关键字" style="width:300px"></el-input>
            <el-select v-model="reportType" clearable placeholder="处理状态" style="margin:0 20px;">
                <el-option
                v-for="item in reportTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            <el-col :span="7" :offset="1">
                <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"  v-model="searchTime.startTime" style="width: 100%;"></el-date-picker>
            </el-col>
            <el-col class="line" :span="1" style="text-align:center">-</el-col>
            <el-col :span="7">
                <el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"  v-model="searchTime.endTime" style="width: 100%;"></el-date-picker>
            </el-col>
                <el-button type="primary" size="medium" @click="search" style="margin-left:10px">筛选</el-button>
            </el-col>
        <el-table
            :data="tableData"
            style="width: 100%">
            <el-table-column
                prop="date"
                label="举报人"
                width="100"
                
                >
            </el-table-column>
            <el-table-column
                prop="name"
                label="被举报人"
                width="180">
            </el-table-column>
            <el-table-column
                prop="phone"
                label="被举报贴"
                min-width="100"
                show-overflow-tooltip
                >
                <template slot-scope="scope">
                    <div style="cursor:pointer;color:#409EFF" @click="toPostDetail(scope.row.id)">
                        {{scope.row.status_name}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column
                prop="sex_name"
                label="理由">
            </el-table-column>
            <el-table-column
                prop="status_name"
                label="处理状态"
                >
            </el-table-column>
            <el-table-column label="操作" min-width='200'>
                <template slot-scope="scope">
                    <el-button  type="primary" @click="forbiddenWords(scope.row.id)">禁言</el-button>
                    <el-button  type="primary" @click="toBlack(scope.row.id)">拉入小黑屋</el-button>
                    <el-button  type="primary" @click="deletePost(scope.row.id)">删帖</el-button>
                </template>
            </el-table-column>
            
        </el-table>
        <el-col :span="24" class="footer-bar">
			<div class="page-code">
				<el-pagination
					background
					:page-size="16"
					layout="prev, pager, next"
					:total="totalPage"
					@current-change="pageChange"
						>
				</el-pagination>
			</div>
    </el-col>

		<el-dialog title="评分" :visible.sync="signatureVisible" @close="initData">
		</el-dialog>
    </div>
</template>
<script>
export default {
    name:'member',
    data() {
        return {
            searchTime:{
                startTime:'',
                endTime:''
            },
            signatureVisible:false,//查看个性签名弹窗状态
            searchText:'',
            reportTypeId:'',//选中的用户id
            operation:'',//选中的表格操作

            reportType:'',//头部筛选的用户类型
            reportTypeOptions:[
                {label:'全部',value:0},
                {label:'普通用户',value:1},
                {label:'认证用户',value:2},
                {label:'圈主',value:3},
                {label:'官方用户',value:4}
            ],

            tableData: [{}],
            page:1,
            totalPage:0    
        }
    },
    methods: {
        search(){
            this.page=1;
            this.getUserReport()
        },
        async getUserReport(){
            //获取会员列表
            let params={
                page:this.page,
                limit:16,
            }
            let res=await this.$api.getUserReport(
                params);
            if(res.data.level=='success'){
                this.tableData=res.data.data;
                this.totalPage=res.data.page_info.total;
            }
        },
        pageChange(e){
			//翻页
			this.page=e;
			this.getUserReport();
        },
        initData(){

        },
        toPostDetail(){
            //跳转帖子详情
            this.$router.push('PostDetail')
        },
        async forbiddenWords(){
            //禁言
            let judge=null
            try {
              judge=  await this.$confirm('删除禁言?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
                })
            } catch (error) {
                judge='cancel'
            }
            console.log(judge)
        },
        async deletePost(){
            //删帖
            let judge=null
            try {
              judge=  await this.$confirm('删除该帖子?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
                })
            } catch (error) {
                judge='cancel'
            }
            console.log(judge)
        },
        async toBlack(){
            //加入小黑屋
            let judge=null
            try {
              judge=  await this.$confirm('加入小黑屋?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
                })
            } catch (error) {
                judge='cancel'
            }
            console.log(judge)
        },

    },
    mounted() {
        this.getUserReport()
    },
}
</script>
<style lang="scss" scoped>
    .action-bar{
			background-color: #f2f2f2;
			height: 60px;
			margin: 10px 0px;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			padding-left: 20px;
			.action-bar-input{
				width: 250px;
				margin-right: 14px;
      }
      .task-form-text{
				color: #666666;
			}
		}
		.el-table-style{
			width: 100%;
			border: 1px solid #f2f2f2;
		}
		.footer-bar{
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: #f2f2f2;
			padding: 8px;
			margin: 10px 0px;
			box-sizing: border-box;
		}
		.dialog-footer{
			text-align: center;
		}
		.executorList{
			display: flex;
			flex-wrap: wrap;
			div{
				margin:10px;
				border:1px solid #eee;
				border-radius: 5px;
				padding:5px 10px;
			}
		}
</style>